#include "widget.h"
#include "ui_widget.h"
#include "base64tool.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_o2b_clicked()
{
    Base64Tool base64Tool;

    QString origin_text = ui->textEdit_origin->toPlainText();

    QString base64String = base64Tool.originToBase64(origin_text);

    ui->textEdit_base64->clear();
    ui->textEdit_base64->setText(base64String);
}

void Widget::on_pushButton_b2o_clicked()
{
    Base64Tool base64Tool;

    QString base64_text = ui->textEdit_base64->toPlainText();

    QString originString = base64Tool.base64ToOrigin(base64_text);

    ui->textEdit_origin->clear();
    ui->textEdit_origin->setText(originString);
}

